import request from '../utils/axios';

export function getObjectList(data) {
	return request({
		url: '/inspectionTarget/getInspectionTargetList',
		method: 'get',
	    params:data
	});
}
export function getInspectionHistory(data) {
	return request({
		url: '/inspectionItemTarget/getInspectionHistory',
		method: 'get',
	    params:data
	});
}

export function getMultiInspections(data) {  
    return request({
        url: '/inspectionItemTarget/exportInspectionTargetItem',
        method: 'post',
        data
    });   
}


export function addOrUpdateObject(data, forEdit) {
    if ( forEdit ) {
        return request({
            url: '/inspectionTarget/editInspectionTarget',
            method: 'put',
            data
        });
    } else {
        return request({
            url: '/inspectionTarget/addInspectionTarget',
            method: 'post',
            data
        });
    }
}

export function batchSetting(data){
	return request({
		url: '/inspectionTarget/batchEditInspectionTarget',
		method: 'put',
		data
	});
}
export function delObject(data) {
	let formData = new FormData();
	Object.keys(data).forEach(key=>{
		formData.append(key, data[key]);
	})
	return request({
		url: '/inspectionTarget/delInspectionTarget',
		method: 'delete',
		data:formData
	});
}

